package com.atguigu.spzx.product.controller;

import com.atguigu.spzx.model.entity.product.Category;
import com.atguigu.spzx.model.vo.common.Result;
import com.atguigu.spzx.model.vo.common.ResultCodeEnum;
import com.atguigu.spzx.product.service.CategoryService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @ClassName: CategoryController
 * @Package: com.atguigu.spzx.product.controller
 * @Description H5首页商品分类
 * @Author 孤妤
 * @Date: 2023/12/18 11:46
 */
@Tag(name = "商品分类")
@RestController
@RequestMapping("/api/product/category")
public class CategoryController {
    @Autowired
    private CategoryService categoryService;
    @GetMapping("/findCategoryTree")
    @Operation(summary = "查询商品分类列表树")
    public Result<List<Category>> findAllCategoryTree(){
        List<Category> categoryList = categoryService.findAllCategoryTree();
        return Result.build(categoryList, ResultCodeEnum.SUCCESS);
    }
}
